<?php

namespace App\Library\Service;

use App\Library\Logic\AmountLogic;
use App\Library\Requests\Amount\AmountPageRequest;
use Illuminate\Http\JsonResponse;

class AmountService extends BaseService
{
    public function __construct(AmountLogic $logic)
    {
        $this->logic= $logic;
    }

    /**
     * 账户流水
     * @param AmountPageRequest $request
     * @return JsonResponse
     *
     */
    public function paging(AmountPageRequest $request): JsonResponse
    {
        return success($this->logic->paging($request));
    }

    public function tj(AmountPageRequest $request): JsonResponse
    {
        return success([
            'total_income' => $this->logic->totalIncome($request),
            'withdraw' => $this->logic->withdraw($request),
        ]);
    }

    /**
     * balance
     * @return JsonResponse
     */
    public function balance(): JsonResponse
    {
        return success($this->logic->balance());
    }
}
